import React from 'react'
import clsx from 'clsx'
import Translate from '@docusaurus/Translate'
import styles from './styles.module.css'
import openharmonyBrand from '@site/static/img/openharmony.svg'

interface FeatureItem {
  title: JSX.Element
  Svg: React.ComponentType<React.ComponentProps<'svg'>>
  description: JSX.Element
  link: string
}

const FeatureList: FeatureItem[] = [
  {
    title: (
      <Translate
        id="component.home.HomepageThanks.openharmony"
        description="about first regarding organizations">
        OpenHarmony
      </Translate>
    ),
    Svg: openharmonyBrand,
    link: 'https://www.openharmony.cn/',
    description: <></>,
  },
]

function Feature({ Svg, link }: FeatureItem) {
  return (
    <div>
      <a href={link} target="_blank" rel="noopener noreferrer">
        <Svg className={styles.featureSvg} role="img" />
      </a>
    </div>
  )
}

export default function HomepageThanks(): JSX.Element {
  return (
    <section className={clsx(styles.features)}>
      <div className="container">
        <div className="row">
          <div className={clsx('col col--12', styles.center)}>
            <p className="hero__subtitle">
              <Translate
                id="component.home.HomepageThanks.title"
                description="about regarding organizations">
                Thanks
              </Translate>
            </p>
          </div>
        </div>
        <div className="row">
          <div className={clsx('col col--12', styles.center)}>
            {FeatureList.map((props, idx) => (
              <Feature key={idx} {...props} />
            ))}
          </div>
        </div>
      </div>
    </section>
  )
}
